package site.xiaodi.proxy.cglib;

import net.sf.cglib.proxy.Enhancer;
import site.xiaodi.proxy.GamePlayer;

/**
 * @author xiao
 * @email 245938767@qq.com
 * @gitee https://gitee.com/liu_yong_qiee/
 * @date 2021/10/6 9:53 上午
 */
public class Client {


    public static void main(String[] args) {
        Enhancer enhancer = new Enhancer();        //工具类
        enhancer.setSuperclass(GamePlayer.class);    //继承被代理类
        enhancer.setCallback(new GamePlayerProxycglib());        //设置回调

        GamePlayer hello = (GamePlayer) enhancer.create();    //生成代理类对象
        hello.login("xiaodi","123423");
        hello.killBoss();
        hello.killBoss();
        hello.upgrade();
    }

}